﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="原料标书录入.aspx.cs" Inherits="syc.Sale.原料标书录入" %>


<head runat="server">
    <title></title>
</head>
<body>
    <script type="text/javascript" language="javascript" src="/common.js"></script>
    <form id="form1" runat="server">
    <div id="wintop" class="wintop">企管处原料招标书-<%=标书名称%></div>
        <asp:Panel ID="Panel1" runat="server" CssClass="panel">
        
            <span style="display:inline-block;width:160px;text-align:right;">
            
                年&nbsp; 度：<asp:DropDownList ID="NianDu" runat="server" Width="80px">                    
                    <asp:ListItem>2009</asp:ListItem>
                    <asp:ListItem>2010</asp:ListItem>
                    <asp:ListItem>2011</asp:ListItem>
                    <asp:ListItem>2012</asp:ListItem>
                    <asp:ListItem>2013</asp:ListItem>
                    <asp:ListItem>2014</asp:ListItem>
                    <asp:ListItem>2015</asp:ListItem>
                </asp:DropDownList>
            </span>          
          
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 季&nbsp; 度 ： 
            <asp:DropDownList ID="JiDu" runat="server" Width="80px">
                <asp:ListItem Value="1">1季度</asp:ListItem>
                <asp:ListItem Value="2">2季度</asp:ListItem>
                <asp:ListItem Value="3">3季度</asp:ListItem>
                <asp:ListItem Value="4">4季度</asp:ListItem>
            </asp:DropDownList>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 原&nbsp; 料：
                <asp:DropDownList ID="YuanLiao" 
                runat="server" DataSourceID="SqlDataSource2" 
                DataTextField="品名" DataValueField="ID" Width="125px">          
            </asp:DropDownList>
            &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; <br />
            </asp:Panel>
            <asp:Panel ID="Panel3" runat="server" CssClass="panel" Visible="true">
                &nbsp;&nbsp; 供货单位： 
                <asp:DropDownList ID="GongHuoShang" runat="server" AutoPostBack="True" 
                    DataSourceID="SqlDataSource3" DataTextField="名称" DataValueField="ID" 
                    Width="90px">
                </asp:DropDownList>
                &nbsp;&nbsp;&nbsp;招标量： 
                <asp:TextBox ID="ZhaoBiaoLiang" runat="server" 
                    onKeyPress="if (event.keyCode!=46 &amp;&amp; event.keyCode!=45 &amp;&amp; (event.keyCode&lt;48 || event.keyCode&gt;57)) event.returnValue=false" 
                    Width="96px"></asp:TextBox>
                &nbsp;&nbsp;&nbsp; 单&nbsp; 价：
            <asp:TextBox ID="DanJia" runat="server" Width="96px"                     
                    onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && (event.keyCode<48 || event.keyCode>57)) event.returnValue=false"></asp:TextBox>              
        
                <asp:Button ID="Button_Export" runat="server" CssClass="button" 
                    onclick="Button_Export_Click" Text="导出Excel" UseSubmitBehavior="false" 
                    Visible="false" />
                <asp:Button ID="Button_Find" runat="server" CssClass="button" 
                    onclick="Button_Find_Click" Text="查询" UseSubmitBehavior="False" 
                    Visible="false" />
                <asp:Button ID="Button_Save" runat="server" CssClass="button" 
                    onclick="Button_Save_Click" Text="添 加" UseSubmitBehavior="False" />                              
               <input id="Button" type="button" value="返回"  
             onclick="document.location.href='BiaoShu_GL.aspx'" class="button" />
        </asp:Panel>
        
        <asp:Panel ID="Panel2" runat="server" CssClass="panel2">
            <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                SelectCommand="SELECT ID,品名 FROM [原料]"></asp:SqlDataSource>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                SelectCommand="SELECT [ID], [名称] FROM [原料供货单位]"></asp:SqlDataSource>
        </asp:Panel>
         <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
	            <tr>
		            <td class="grid-title">标书明细</td>
		        </tr>
		        <tr>
		            <td class="grid-back">
                          <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                             SelectCommand="SELECT 原料中标书.年度, 原料中标书.季度, 原料中标书.原料ID, 原料中标书.供货单位ID, 原料.品名, 原料.规格, 原料.单位, 原料供货单位.名称, 原料中标书.数量, 原料中标书.单价, 原料中标书.日期, 原料中标书.原料标书名ID FROM 原料中标书 INNER JOIN 原料 ON 原料中标书.原料ID = 原料.ID INNER JOIN 原料供货单位 ON 原料供货单位.ID = 原料中标书.供货单位ID WHERE 原料中标书.原料标书名ID=@原料标书名ID"
                             UpdateCommand="update 原料中标书 set 数量=@数量,单价=@单价 where 年度=@年度 and 季度=@季度 and 原料ID=@原料ID and 供货单位ID=@供货单位ID and 原料中标书.原料标书名ID=@原料标书名ID"
                             DeleteCommand="delete 原料中标书 where 年度=@年度 and 季度=@季度 and 原料ID=@原料ID and 供货单位ID=@供货单位ID and 原料中标书.原料标书名ID=@原料标书名ID"
                             >
                             <SelectParameters>
                                <asp:ControlParameter ControlID="NianDu" Name="年度" PropertyName="SelectedValue" 
                                     Type="Int32" />
                                <asp:ControlParameter ControlID="JiDu" Name="季度" PropertyName="SelectedValue" 
                                     Type="Int32" /> 
                                <asp:ControlParameter ControlID="YuanLiao" Name="原料ID" PropertyName="SelectedValue" 
                                     Type="Int32" /> 
                                <asp:QueryStringParameter Name="原料标书名ID" QueryStringField="BiaoShuID" />
                             </SelectParameters>                             
                             <UpdateParameters>
                                 <asp:Parameter Name="数量" />
                                 <asp:Parameter Name="单价" />
                                 <asp:ControlParameter ControlID="NianDu" Name="年度" PropertyName="SelectedValue" 
                                     Type="Int32" />
                                 <asp:ControlParameter ControlID="JiDu" Name="季度" PropertyName="SelectedValue" 
                                     Type="Int32" />
                                 
                                 <asp:Parameter Name="原料ID" />
                                 <asp:Parameter Name="供货单位ID" />
                                 <asp:QueryStringParameter Name="原料标书名ID" QueryStringField="BiaoShuID" />
                             </UpdateParameters>
                             <DeleteParameters>
                                 <asp:ControlParameter ControlID="NianDu" Name="年度" PropertyName="SelectedValue" 
                                     Type="Int32" />
                                 <asp:ControlParameter ControlID="JiDu" Name="季度" PropertyName="SelectedValue" 
                                     Type="Int32" /> 
                                                         
                                 <asp:Parameter Name="原料ID" />
                                 <asp:Parameter Name="供货单位ID" />
                                 <asp:QueryStringParameter Name="原料标书名ID" QueryStringField="BiaoShuID" />
                             </DeleteParameters>
                             </asp:SqlDataSource>
           <asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="20"
                            AutoGenerateColumns="False" CssClass="grid" 
                            DataSourceID="SqlDataSource1" 
                            GridLines="None" ondatabound="GridView1_DataBound" 
                            onpageindexchanged="GridView1_PageIndexChanged" 
                            UseAccessibleHeader="False" DataKeyNames="年度,季度,原料ID,供货单位ID" 
                            onrowediting="GridView1_RowEditing">
                            <PagerSettings Visible="False" />
                            <RowStyle CssClass="grid-row-normal" />
            <Columns>
                <asp:TemplateField HeaderText="年度" SortExpression="年度" >                   
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("年度") %>'></asp:Label>
                    </ItemTemplate>
                     <HeaderStyle CssClass="grid-header" />
                     <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="40px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="季度" SortExpression="季度" >
                   
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("季度") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid-header" />
                     <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="40px" />
                </asp:TemplateField>
                 <asp:TemplateField HeaderText="原料ID" SortExpression="原料ID" Visible ="false">
                    <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("原料ID") %>'  ></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid-header" />
                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="40px" />
                    </asp:TemplateField>
                 <asp:TemplateField HeaderText="品名" SortExpression="品名">                   
                    <ItemTemplate>
                        <asp:Label ID="Label7" runat="server" Text='<%# Bind("品名") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid-header" />
                     <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="90px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="供货单位" SortExpression="名称">                   
                    <ItemTemplate>
                        <asp:Label ID="Label8" runat="server" Text='<%# Bind("名称") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid-header" />
                     <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                </asp:TemplateField>
                   <asp:TemplateField HeaderText="规格" SortExpression="规格">                   
                    <ItemTemplate>
                        <asp:Label ID="Label9" runat="server" Text='<%# Bind("规格") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid-header" />
                     <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                </asp:TemplateField>
                   <asp:TemplateField HeaderText="单位" SortExpression="单位">                   
                    <ItemTemplate>
                        <asp:Label ID="Label10" runat="server" Text='<%# Bind("单位") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid-header" />
                     <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="招标量" SortExpression="招标量">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("数量") %>' onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && (event.keyCode<48 || event.keyCode>57)) event.returnValue=false"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("数量") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid-header" />
                     <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="单价" SortExpression="单价">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("单价") %>' onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && (event.keyCode<48 || event.keyCode>57)) event.returnValue=false"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("单价") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid-header" />
                     <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                </asp:TemplateField>   
                 <asp:BoundField DataField="日期" HeaderText="日期" SortExpression="日期"   Visible="false"
                    ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header"
                                     ItemStyle-Width="80" ItemStyle-HorizontalAlign="Center" 
                    DataFormatString="{0:d}" >
                                    <HeaderStyle CssClass="grid-header"></HeaderStyle>
                <ItemStyle HorizontalAlign="Center" CssClass="grid" Width="80px" ></ItemStyle></asp:BoundField>           
                  <asp:TemplateField  >                                 
                   <EditItemTemplate>
                   <asp:Button ID="Button1" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="更新" CssClass="smallbutton" />
                   <asp:Button ID="Button2" runat="server" CausesValidation="False" 
                    CommandName="Cancel" Text="取消" CssClass="smallbutton" />
                   </EditItemTemplate>
                   <ItemTemplate>
                   <asp:Button ID="Button1" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="编辑" CssClass="smallbutton" />
                    <asp:Button ID="Button2" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="删除" CssClass="smallbutton" onclientclick="if(!confirm('确认删除该条记录吗?')) return false;" />
                   </ItemTemplate>                                    
                   </asp:TemplateField>       
            </Columns>
           
        </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>   
		                <table width="100%">
		                    <tr>
		                        <td class="pagebar">
                                    <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                        CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                    <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                        CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                    <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                        ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server"></asp:Label><input type="button" class="page-split" />
                                    
                                    <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                        CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                    <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                        CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                                </td>
                                <td class="pagebar" align="right">
                                    <asp:Label ID="Label_Total" runat="server"></asp:Label>
                                </td>
                            </tr>
                       </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
    
</form>    
</body>
</html>
